import type { AddressItem, AddressParams } from "@/types/address"
import { http } from "@/utils/http"

export const postMemberAddressAPI = (data: AddressParams) => {
    return http({
        method: 'POST',
        url: '/member/address',
        data
    })
}

export const getMemberAddressAPI = () => {
    return http<AddressItem>({
        method: 'GET',
        url: '/member/address'
    })
}

export const getMemberressByIdAPI = (id: string) => {
    return http<AddressItem>({
        method: 'GET',
        url: `/member/address/${id}`
    })
}

//修改收货地址
export const postMemberAddressByIdAPI = (id: string, data: AddressParams) => {
    return http({
        method: 'PUT',
        url: `/member/address/${id}`,
        data
    })
}

//删除收货地址
export const deleteMemberAddressByIdAPI = (id: string) => {
    return http({
        method: 'DELETE',
        url: `/member/address/${id}`,
    })
}